package com.jdiv.samples.truco;

import java.awt.Color;

import com.jdiv.JProcess;

public class Carta extends JProcess {

	private int num;
	private int velocidad=3;
	private int box;
	
	private int nums[]=new int[40];
	
	
	public Carta(int num,int x,int y){

		this.x=x;
		this.y=y;
		this.num=num;
		
		cargarValores();
	}
	
	public Carta(int num){

		this.num=num;
		
		cargarValores();
	}
	
	private void cargarValores() {
	int cont=1;	
	/*
	// 0| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |    ORO
	//10| 11| 12| 13| 14| 15| 16| 17| 18| 19|    COPA
	//20| 21| 22| 23| 24| 25| 26| 27| 28| 29|    ESPADA
	//30| 31| 32| 33| 34| 35| 36| 37| 38| 39|    BASTON
	//--|---|---|---|---|---|---|---|---|---|
	// 1| 2 | 3 | 4 | 5 | 6 | 7 | 10| 11| 12|
	
	*/
		for (int i=0; i < 40; i++){
			
				if 	(i == 7 || i == 17 || i == 27 || i == 37)
				 cont=10;
			else 
			if (i == 8 || i == 18 || i == 28 || i == 38)
				 cont = 11;
			else 
			if (i == 9 || i == 19 || i == 29 || i == 39)
				 cont = 12;
			
			if ((i % 10) == 0) cont = 1;
			
			
			nums[i]=cont;

			cont++;
		}
		
		
		//System.out.println(nums[8]+" "+nums[18]+" "+nums[28]+" "+nums[38]);
	}

	public void begin() {
		String name="";
		
		System.out.println(num);
		
		if 	(num>=0 && num<=9)
			name="ORO ";
		else 
		if 	(num>=10 && num<=19)
			name="COPA ";
		else 
		if 	(num>=20 && num<=29)
			name="ESPADA ";
		else 
		if 	(num>=30 && num<=39)
			name="BASTO ";
		
		name+=nums[num];
		drawing_color(Color.BLUE);
		box = draw_box(x,y,100,50);
		write(0,x+25,y+25,0,name);
		
		
	}
	
	public void loop(){
		/*
		if (key(_UP)) y-=velocidad;
		if (key(_DOWN)) y+=velocidad;
		if (key(_LEFT)) x-=velocidad;
		if (key(_RIGHT)) x+=velocidad;
		
		
		move_draw(box,x,y);*/
		
	}

}
